

macro(add_boost_component)


    #add_definitions( -DBOOST_ALL_NO_LIB )

    set(BOOST_ROOT ${MY_EXTERNAL_ROOT}/boost)
    if (ADDRESS_MODEL MATCHES "64")
        set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib64)
    else()
        set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib32)
    endif()

    set(Boost_USE_STATIC_LIBS ON)
    set(Boost_USE_MULTITHREADED TRUE)
    find_package (Boost COMPONENTS ${boost_COMPONENTS} REQUIRED)
    if(NOT Boost_FOUND)
        message(FATAL_ERROR "BOOST NOT FOUND: " ${BOOST_ROOT} )
    endif()
    add_definitions(-DBOOST_THREAD_USE_LIB)
endmacro()

macro(add_boost)

    if(boost_COMPONENTS STREQUAL "all")
        set(boost_COMPONENTS
        atomic chrono context coroutine date_time exception filesystem graph iostreams locale log
        log_setup math_c99 program_options random regex serialization signals system thread timer wave wserialization )
    endif()

    add_boost_component()

    list(APPEND EXTERNAL_LIB_HEADERS_PATH ${Boost_INCLUDE_DIRS} )
    list(APPEND EXTERNAL_LIB_NAMES_PATH   ${Boost_LIBRARY_DIRS} )
    list(APPEND EXTERNAL_LIB_NAMES        ${Boost_LIBRARIES}    )
endmacro()



add_boost()
